package com.park.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.park.entity.BlackList;
import com.park.entity.User;
import com.park.mapper.BlackListMapper;
import com.park.service.BlackListService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class BlackListServiceImpl extends ServiceImpl<BlackListMapper,BlackList> implements BlackListService {

    @Resource
    private BlackListMapper blackListMapper;

    //分页查询
    @Override
    public Page<BlackList> selectPage(int current) {
        Page<BlackList> page = new Page<>(current, 6);
        return blackListMapper.selectPage(page, null);

    }

    //模糊查询
    @Override
    public List<BlackList> getByBlackListCarId (String carId, int current){
        int start=current*6-6;
        int end=current*6;
        return baseMapper.getByBlackListCarId(carId,start,end);
    }

    //模糊查询总数
    @Override
    public int getBlackListPage(String carId) {
        return baseMapper.getBlackListPage(carId);
    }

    //删除用户
    @Override
    public int delBlackList(int blacklistId){
        int result=blackListMapper.deleteById(blacklistId);
        return result;
    }
}
